package com.hsgene.discount.persistence;


import com.hsgene.discount.condition.DiscountCondition;
import com.hsgene.discount.domain.GeneticDiscount;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GeneticDiscountMapper{
    /**
     * 删除（真删）
     * @param id
     * @return
     */
    int deleteByPrimaryKey(String id);

    /**
     * 插入
     * @param record
     * @return
     */
    int insert(GeneticDiscount record);

    /**
     * 插入（不为空字段不插入）
     * @param record
     * @return
     */
    int insertSelective(GeneticDiscount record);

    /**
     * 根据主键查询
     * @param id
     * @return
     */
    GeneticDiscount selectByPrimaryKey(String id);

    /**
     * 修改（不为空的）
     * @param record
     * @return
     */
    int updateByPrimaryKeySelective(GeneticDiscount record);

    /**
     * 修改（全部字段）
     * @param record
     * @return
     */
    int updateByPrimaryKey(GeneticDiscount record);

    /**
     * 根据优惠金额，条件金额，使用时间查询优惠券
     * @param geneticDiscount
     * @return
     */
    GeneticDiscount getByDiscount(GeneticDiscount geneticDiscount);

    /**
     * 获取总数
     * @param condition
     * @return
     */
    int getCount(@Param("condition") DiscountCondition condition);

    /**
     * 分页
     * @param condition
     * @return
     */
    List<GeneticDiscount> queryList(@Param("condition") DiscountCondition condition);

    /**
     * 批量删除
     * @param discountList
     */
    void deleteDiscountMore(@Param("discountList") List<GeneticDiscount> discountList);
}